package ymr.log;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class Logger {

		/**
		 * @param message which is written to the file.
		 */
		public void log(String message){

		try {
			String file = "log.txt";
				PrintWriter pw = new PrintWriter(
						new BufferedWriter(
								new OutputStreamWriter(
										new FileOutputStream(
											"src/"+file, true))));	
					
			pw.println(System.currentTimeMillis() + " " + message);
			
			pw.flush();		// close buffer
			pw.close();		// close file
						
			} catch (IOException e) {
				System.out.println("Kirjutamisel juhtus viga: " + e);
			}
		}
}
